<?

include('config.php');
include('header.php');
$SYS = new SYS;

$SYS->connectDB($db);

//Set Domain
$domain = $_SERVER['HTTP_HOST'];
$SYS->domain = preg_replace("/^www\./", "", $domain);

//Set Request
if (!isset($_GET['request']) || $_GET['request']=="") $_GET['request']='default';
$request = $_GET['request'];
$request = str_replace('..','.',$request);
$request = str_replace('<','',$request);
$request = str_replace('>','',$request);
$SYS->request = $request;

//Set Controller, Action, Parameters
$parts = explode('/',$SYS->request);
$SYS->controller = $parts[0];
$SYS->action = $parts[1];
$SYS->parameters = array_slice($parts, 2);


if (file_exists('controller/' . $SYS->controller . '.php'))
{
  include('controller/' . $SYS->controller . '.php');
}
else
{
  include('controller/404.php');
}

mysql_close();
?>